/**
 * 
 */
package model;

import java.sql.ResultSet;
import myutil.Connect;

import vo.LoginInfoVo;

/**
 * @author Sony
 * 
 */
public class ForgotPasswordMo {
	public String getSecurityQuestion(String login_id, String site)
			throws Exception {
		Connect c = new Connect();
		c.site = site;
		String question = null;
		ResultSet rs = c
				.getResult("select security_question from login_info where login_id='"
						+ login_id + "'");
		while (rs.next()) {
			question = rs.getString("security_question");
		}
		return question;

	}

	public String resetPassword(String login_id, String site, String password)
			throws Exception {
		Connect c = new Connect();
		c.site = site;
		String question = null;
		ResultSet rs = c
				.getResult("select security_question from login_info where login_id='"
						+ login_id + "'");
		while (rs.next()) {
			question = rs.getString("security_question");
		}
		return question;

	}

	public void checkSecurityAnswer(LoginInfoVo vo, String site) throws Exception {
		Connect c = new Connect();
		c.site = site;
		ResultSet rs = c.getResult("select * from login_info where login_id='"+vo.getLogin_id()+"' and security_question_answer='"+vo.getSecurity_question_answer()+"'");
		while (rs.next()) {
			
		}
		

	}

	public void resetPassword(LoginInfoVo vo, String site) throws Exception {
		Connect c = new Connect();
		c.site = site;
		//System.out.println(vo.getLogin_id()+" : "+vo.getPassword());
		c.dml("update login_info set password='"+vo.getPassword()+"' where login_id='"+vo.getLogin_id()+"'");
	}
}
